/*
 * @Description:
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2023-09-25 08:54:25
 * @LastEditors: swc
 * @LastEditTime: 2024-08-16 14:38:03
 */
import lexicon from '@/lib/lexicon';
import { I_kv } from './base/kv';

export interface I_userInfo {
  userID: string;
  userNo: string;
  userName: string;
  isGuest: boolean;
}
export interface I_funInfo {
  mainFun: string;
  mainFunID: string;
  deputyFunIDs: Array<string>;
  deputyFunInfo: Array<I_kv>;
  deputyFuns: Array<string>;
}
export class T_event {
  private url: string = lexicon.url.event;

  // sp 关系型数据库存储过程，ruleLib 规则引擎规则 sysRule后端固定算法 webReq 调用第三方web Api svcLogic 调用逻辑服务
  public type: 'sp' | 'ruleLib' | 'sysRule' | 'webReq' | 'svcLogic';

  public cmd: string;

  // 特定参数 一般用在 ruleLib sysRule里根据cmd一一对应的特定参数
  public params?: object;

  // 执行命令 存储过程名 规则编号 命令关键字
  // 为了兼容1.0 sp用法 pData 后端传将userInfo,funInfo放进data里包装成pData传给sp
  protected userInfo: I_userInfo;

  protected funInfo: I_funInfo;

  // 功能名：rowData
  data?: {
    [key: string]: Array<any>;
  };

  constructor(userInfo: I_userInfo, funInfo: I_funInfo) {
    this.userInfo = userInfo;
    this.funInfo = funInfo;
  }
}

export interface I_event extends T_event {}
